# 导包
from copy import copy
from copy import deepcopy

# 不可变类型: 整数,浮点数,字符串,元组
# 整数
a1 = 10
b1 = copy(a1)
c1 = deepcopy(a1)
print(a1, b1, c1)
print(id(a1), id(b1), id(c1))
print('-----------------------------------------------')
# 浮点数
a2 = 3.14
b2 = copy(a2)
c2 = deepcopy(a2)
print(a2, b2, c2)
print(id(a2), id(b2), id(c2))
print('-----------------------------------------------')
# 字符串
a3 = "你好"
b3 = copy(a3)
c3 = deepcopy(a3)
print(a3, b3, c3)
print(id(a3), id(b3), id(c3))
print('-----------------------------------------------')
# 元组
a4 = (1, 2, 3)
b4 = copy(a4)
c4 = deepcopy(a4)
print(a4, b4, c4)
print(id(a4), id(b4), id(c4))
print('============================================================')
# 可变类型: 列表,集合,字典
# 列表
a5 = [1, 2, 3]
b5 = copy(a5)
c5 = deepcopy(a5)
print(a5, b5, c5)
print(id(a5), id(b5), id(c5))
print('-----------------------------------------------')
# 集合
a6 = {1, 2, 3}
b6 = copy(a6)
c6 = deepcopy(a6)
print(a6, b6, c6)
print(id(a6), id(b6), id(c6))
print('-----------------------------------------------')
# 字典
a7 = {1: 'a', 2: 'a', 3: 'a'}
b7 = copy(a7)
c7 = deepcopy(a7)
print(a7, b7, c7)
print(id(a7), id(b7), id(c7))
"""
深浅拷贝的相同点
对于不可变类型: 都没有开辟新的空间,都只是引用地址传递
对于可变类型只有1层时: 都开辟了新的空间,都能拷贝成功,互相之间不受影响
"""
